#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive

${HIVE_HOME} -S -e "

create database if not exists edu_dwb;
use edu_dwb;

drop table if exists hcx_dwb_customer_relationship_wide;
create table hcx_dwb_customer_relationship_wide
(
    id                       int,
    create_date_time         timestamp,
    deleted                  string comment '是否禁用',
    customer_id              integer comment '所属客户id',
    origin_type              varchar(255) comment '线上线下',
    origin_channel           varchar(255) comment '来源渠道',
    creator                  int comment '负责这个意向信息的销售员工id',
    itcast_school_id         int comment '校区id',
    itcast_subject_id        int comment '学科id',

    customer_relationship_id INT comment '客户关系id',
    clue_state               varchar(255) comment '线索状态',

    cus_id                   int comment '客户id',
    cus_area                 varchar(255) comment '区域',


    emp_id                   int comment '员工id',
    department_id            integer comment '部门编号',
    department_name          varchar(255) comment '部门名',

    sch_id                   int,
    sch_name                 varchar(255),

    sub_id                   int,
    sub_name                 varchar(255)
);


drop table if exists hcx_dwb_customer_clue_wide;
create table hcx_dwb_customer_clue_wide
(
    id                             INT,
    customer_relationship_id       INT comment '客户关系id',
    create_date_time               timestamp comment '创建时间',
    clue_state                     string comment '线索状态',


    cr_id                          int,
    deleted                        string comment '是否被删除（禁用）',
    origin_type                    string comment '数据来源',

    customer_relationship_first_id int comment '第一条客户关系id',
    appeal_status                  string comment '申诉状态，0:待稽核 1:无效 2：有效'
)






-- hive.dwd.hcx_dim_dwd_itcast_school
-- hive.dwd.
-- hive.dwd.hcx_dim_dwd_itcast_subject
-- hive.dwd.hcx_dim_dwd_employee
-- hive.dwd.hcx_dim_dwd_department
-- hive.dwd.hcx_dim_dwd_customer
-- hive.dwd.hcx_fact_dwd_customer_relationship;“